package com.plant.addproduct.controller;

import com.plant.addproduct.domain.Addproduct;
import com.plant.addproduct.mapper.AddproductMapper;
import com.plant.addproduct.service.AddproductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/addproduct")
public class AddproductController {

    @Autowired
    private AddproductService addproductService;

    @RequestMapping("/findAddproduct")
    public List<Addproduct> findAddproduct() {
        return addproductService.findAddproduct();
    }
    @Autowired
    private AddproductMapper addproductMapper;
    @RequestMapping("/findAddproduct2")
    public List<Addproduct> findAddproduct2() {
        return addproductMapper.findAddproduct2();
    }

    @PostMapping("/addpro")
    public boolean addpro(@RequestBody Addproduct addproduct) {
        return addproductService.addpro(addproduct);
    }
    @PostMapping("/updatepro")
    public int updatepro(@RequestBody Addproduct addproduct) {
        return addproductService.updatepro(addproduct);
    }
    @GetMapping("/delete")
    public boolean delete(@RequestParam("sid") Integer sid) {
        return addproductService.delete(sid);
    }
    @GetMapping("/findAll")
    public Addproduct findAll(@RequestParam("sid") Integer sid) {
        return addproductService.findAll(sid);
    }
    @GetMapping("/updatestatus")
    public int updatestatus(@RequestParam("sid") Integer sid){
        return addproductService.updatestatus(sid);
    }
    @GetMapping("/updatestatus1")
    public int updatestatus1(@RequestParam("sid") Integer sid){
        return addproductService.updatestatus1(sid);
    }
}
